﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using Aga.Psad.Common;

namespace Aga.Psad.Backend.Entities
{
    public partial class Imagen
    {
        private string FullPath
        {
            get
            {
                if (this.Carpeta != null)
                    return Path.Combine(this.Carpeta, this.Nombre);
                else
                    return this.Nombre;
            }
        }

        public FileStream GetImage()
        {
            string outputFile = Path.Combine(Config.ImageFilesRootFolderPath, this.FullPath);

            return (new FileStream(outputFile, FileMode.Open, FileAccess.Read, FileShare.ReadWrite));
        }
    }
}
